<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">

<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<script type="text/javascript">
function show(){
 var xmlhttp;
 var my_JSON_object = {};
    if(window.XMLHttpRequest){
  
     xmlhttp=new XMLHttpRequest(); 
    }else{
     xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange=function(){
     if (xmlhttp.readyState == 4) {
         if (xmlhttp.status == 200) {
          my_JSON_object = JSON.parse(xmlhttp.responseText);
          document.getElementById("Name").innerHTML =my_JSON_object.name;
          document.getElementById("SurName").innerHTML =my_JSON_object.surname;
          document.getElementById("Q").innerHTML =my_JSON_object.Q;
          } else {
           alert("HTTP error " + xmlhttp.status + ": " + xmlhttp.statusText);
         }
       }
    
    }
 
    xmlhttp.open("POST","CAAAtestRequest.jsp?q=123",false);
    xmlhttp.send();
   
}
</script>

<body>
  <a href="#" onclick="show()"> Click here to get JSON data from the server side</a>
 
  <font id="Name"></font>
  <font id="SurName"></font>
  <font id="Q"></font>
</html>